package com.hg;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class Logon extends ActionSupport {

	
	public String login(){
		if(isInvalid(getUsername())) return INPUT;
		if(isInvalid(getPassword())) return INPUT;
		ActionContext.getContext().getSession().put("baifs", getUsername());
		return SUCCESS;
	}
	
	public boolean isInvalid(String str){
		return (str.length()==0 || str == null);
	}
	
	private String username;
	private String password;
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
}
